package tk.mybatis.springboot.wexin.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import net.sf.json.JSONObject;
import tk.mybatis.springboot.api.controller.BaseController;
import tk.mybatis.springboot.wexin.service.WeixinService;
import tk.mybatis.springboot.wexin.util.WeixinUtil;

@Service
@Transactional
public class WeixinServiceImpl implements WeixinService{
	@Override
	public JSONObject createMenu() throws Exception {
		String accessToken = WeixinUtil.getAccessToken();
		int request = WeixinUtil.createMenu(accessToken);
		if(request == 0){
			return BaseController.success("创建菜单成功");
		}else{
			return BaseController.error("创建菜单失败", "9999");
		} 
	}

	@Override
	public JSONObject createCustom(String json) {
		// TODO Auto-generated method stub
		return null;
	}
}
